package top.bulk.sse.service;

import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import top.bulk.sse.dto.CommonSseParam;

/**
 * service层
 *
 * @author 散装java
 * @date 2024-09-10
 */
public interface SseEmitterService {

    /**
     * 创建连接
     **/
    SseEmitter createSseConnect(String clientId, String loginId, Boolean setHeartBeat);

    /**
     * 关闭连接
     **/
    void closeSseConnect(String clientId);

    /**
     * 推送消息到所有客户端
     **/
    void sendMessageToAllClient(String msg);

    /**
     * 根据clientId发送消息给某一客户端
     **/
    void sendMessageToOneClient(String clientId, String msg);

    SseEmitter chat(CommonSseParam param);
}
